package com.alinesno.cloud.platform.cas.web.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 数据拦截
 * 
 * @author WeiXiaoJin
 * @since 2019年11月8日 下午8:45:25
 */
public class RequestRoleAdvice {

	private static final Logger log = LoggerFactory.getLogger(RequestRoleAdvice.class);

	public void pointcut() {
		System.out.println("执行时间:【" + System.currentTimeMillis() + "】毫秒");
	}

	public Object around(ProceedingJoinPoint point) {
		Object result = null;

		long beginTime = System.currentTimeMillis();
		try {
			// 执行方法
			result = point.proceed();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		// 执行时长(毫秒)
		long time = System.currentTimeMillis() - beginTime;

		System.out.println("执行时间:【" + time + "】毫秒");
		log.debug("执行时间:【{}】毫秒", time);
		return result;
	}

}
